home *** CD-ROM | disk | FTP | other *** search
-
- #pragma once
-
- /*=======================================================================*/
- /*=== This file contains a set of utilities for doing nifty math stuff ==*/
- /*=======================================================================*/
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #define IN_RANGE( x, lo, hi) ((x >= lo) && (x <= hi))
- #define PINTORANGE(x, lo, hi) ((IN_RANGE(x, lo, hi) ? x : (x < lo) ? lo : hi))
- #define Max(x, y) ((x) > (y) ? (x) : (y))
- #define Min(x, y) ((x) < (y) ? (x) : (y))
- #define SIGN(x) ((x > 0) ? 1 : -1)
- #define ODD(x) (ceil(x/2.0) != (x/2))
- #define EVEN(x) (ceil(x/2.0) == (x/2))
-
- int ReturnEven (int TheInt);
- /* return TheInt (if even) or TheInt+1 (if odd) */
-
- Boolean odd (long theval);
- /* return true if theVal is odd */
-
- Boolean even (long theval);
- /* return true if theVal is even */
-
- #ifdef __cplusplus
- }
- #endif
-